const { default: axios } = require("axios");
const { dewuHeaders } = require("../../tools");
const sign = require("../../tools/sign");

/**
 * Dewu-API根据spuId获取产品各尺码价格
 * @param {import("koa").Context} ctx  - 路由上下文
 *  */

module.exports = async(ctx) => {
    let { spuId } = ctx.request.query;
    const signId = sign({
        spuId: spuId,
    })

    let result = await axios.post('https://app.dewu.com/api/v1/h5/inventory/price/h5/queryBuyNowInfo', {
        sign: signId,
        spuId: spuId,
    }, {
        headers: dewuHeaders()
    });
    ctx.body = result.data
}